//
//  ProgressViewViewController.swift
//  DemoProject
//
//  Created by hao on 2018/7/18.
//  Copyright © 2018年 hao. All rights reserved.
//

import UIKit

class ProgressViewViewController: BaseTableViewController {

    lazy var progressView: UIProgressView = {
        let _progress = UIProgressView(progressViewStyle: .bar)
        self.tableHeadView.addSubview(_progress)
        _progress.snp.makeConstraints({ (make) in
            make.center.equalTo(self.tableHeadView)
            make.width.equalTo(200)
            make.height.equalTo(10)
        })
        return _progress
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupData()
        progressView.trackTintColor = UIColor.green
        progressView.setProgress(0.2, animated: true)
    }
    
    private func setupData() {
        let titles = ["创建进度条",
                      "设置进度，同时有动画效果",
                      "改变已有进度颜色",
                      "剩余进度颜色（即进度槽颜色）"]
        
        let descArr = [
                       """
                        let progressView = UIProgressView(progressViewStyle: .default)
                        progressView.center = self.view.center
                        progressView.progress = 0.5 //默认进度50%
                        self.view.addSubview(progressView)
                       """,
                       "progressView.setProgress(0.8, animated:true)",
                       "progressView.progressTintColor = UIColor.green",
                       "progressView.trackTintColor = UIColor.blue"]
        
        addTitles(titles, footDescs: descArr)
    }

}
